<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!--  --><!DOCTYPE HTML>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8">
  <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
  <script type="text/javascript" src="js/jquery.js"></script>
  <link type="text/javascript" href="js/bootstrap.min.js" /> 
    <title>欢迎登陆KaiSheng的项目管理项目系统</title>
     <style type="text/css">
    	.well{
    		margin-top:70px;
    		width:30%;
    		padding-left:100px;
    	}
    	.navbar{
    		margin-top:70px;
    		width:600px;
    		margin-left:380px;
    	}
    	.container{
    		padding-left:30px;
    	}
    </style>
  </head>
  <body>
  	<% String state= (String)request.getAttribute("state");
  		String msg=(String)session.getAttribute("msg");
  		if("-10001".equals(state)){%>
  			   <div class="alert alert-error" style="padding-left:300px;">
					账户或密码错误
   				 </div>
  		<%}%>
  		
  		<%
  		//在用户登陆进入系统，关掉浏览器，打开历史记录想直接进入系统时，我们让他回到首页后给予提示：登录后再操作！并销毁掉session
  		if(msg!=null){ %>
  			<div class="alert alert-error" style="padding-left:300px;">
					<%=msg %>
   			 </div>
   		<%
   			session.invalidate();
   		} %>
  
  
  
  	<div class="navbar" >
      <div class="navbar-inner">
        <div class="container">
          <a href="#" class="brand">KaiSheng-PMS:欢迎登陆KaiSheng的项目管理项目系统</a>
        </div>
      </div>
    </div>
  	
  	
  
  	<form  class="well container"  id="myform" action="login.jspx" method="post" style="width:540px;" >
  		<input type="hidden" name="m" value="login" />
  		<div style="margin-left:130px;">
        <label >账户</label>
        <input type="text" class="span3" id="username" name="username" onkeydown="clearError('nameerror')" onblur="validateForm()" autocomplete="off"/> 
        <span style="color:red" id="nameerror" ></span>
        
        <label>密码</label>
        <input type="password" class="span3" id="password" name="password" onkeydown="clearError('pswerror')" onblur="validateForm()" autocomplete="off"/>
        <span style="color:red" id="pswerror" ></span><br><br>
        
        <input type="radio" name="remember" value="yes"> 记住密码 <br><br>
        
        <button class="btn btn-primary" type="button" onclick="submitForm()"><i class="icon-user icon-white"></i> Submit</button>
        &nbsp; &nbsp; &nbsp; &nbsp;
		<button class="btn btn-danger"><i class="icon-trash icon-white"></i>Cancle</button> 
		</div>
    </form>
      
     <script type="text/javascript">
			function validateForm(){
				var username=document.getElementById("username").value;
				var password=document.getElementById("password").value;
				
				if(username.trim().length==0){
					document.getElementById("username").value="";
					document.getElementById("nameerror").innerHTML="您规则输入用户名";
					document.getElementById("username").focus();
					return false;
				}else if(password.length==0){
					document.getElementById("password").value="";
					document.getElementById("pswerror").innerHTML="您规则输入密码";
					document.getElementById("password").focus();
					return false;
				}
				return true;
			}
			function clearError(obj){
				document.getElementById(obj).innerHTML="";
			}
			function submitForm(){
				var username=document.getElementById("username").value;
				var password=document.getElementById("password").value;
				
				if(username.trim().length==0){
				document.getElementById("username").value="";
				document.getElementById("nameerror").innerHTML="您规则输入用户名";
				document.getElementById("username").focus();
					return;
				}else if(password.length==0){
					document.getElementById("password").value="";//当输入为空时去掉空格
					document.getElementById("pswerror").innerHTML="您规则输入密码";
					document.getElementById("password").focus();
					return;
				}
				
				document.getElementById("myform").submit();
			}
     </script>
  </body>
</html>